# -*- coding: utf-8 -*-
"""
响应数据schemas
@api-version: 1.0.0
"""

from marshmallow import Schema, fields

class ResponseSchema(Schema):
    """统一响应格式schema"""
    code = fields.Int(required=True, description='状态码')
    success = fields.Bool(required=True, description='是否成功')
    message = fields.Str(required=True, description='响应消息')
    data = fields.Raw(allow_none=True, description='响应数据')

class PaginationSchema(Schema):
    """分页数据schema"""
    items = fields.List(fields.Raw(), description='数据列表')
    total = fields.Int(description='总数量')
    page = fields.Int(description='当前页码')
    pageSize = fields.Int(description='每页数量', data_key='pageSize')
    totalPages = fields.Int(description='总页数', data_key='totalPages')

class TokenResponseSchema(Schema):
    """Token响应schema"""
    token = fields.Str(required=True, description='访问令牌')
    refreshToken = fields.Str(required=True, description='刷新令牌', data_key='refreshToken')
    expiresAt = fields.DateTime(required=True, description='过期时间', data_key='expiresAt')
    user = fields.Nested('UserSchema', description='用户信息')